<template>
  <div>
    <el-container>
      <el-header>
        <div class="logo">
          <img src="../assets/logos.jpg" alt="" />
          <span><b>xsx-lc 后台管理系统</b></span>
        </div>
        <el-button type="info" @click="lclogout"> 退出 </el-button>
      </el-header>
      <el-container>
        <el-aside :width="isCollapse ? '64px' : '200px'">
          <el-menu
           
            class="el-menu-vertical-demo"
            background-color="#333744"
            text-color="#fff"
            router
            :collapse="isCollapse"
            :unique-opened='true'
          >
            <p class="extend" @click="isCollapse = !isCollapse">|||</p>
            <el-submenu :index="item.path" v-for="(item, index) in menulist" :key="index">
              <template slot="title">
                <i :class="iconsobj[index]"></i>
                <span>{{ item.authName }}</span>
              </template>
              <el-menu-item-group>
                <el-menu-item
                  :index="ite.path"
                  v-for="(ite, inde) in item.children"
                  :key="inde"
                  >
                  <i class="el-icon-location"></i>
                  {{ ite.authName }}</el-menu-item
                >
              </el-menu-item-group>
            </el-submenu>
          </el-menu>
        </el-aside>
        <el-main>
          <router-view> </router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import muney from '../api/index'
export default {
  components: {},
  name: "",
  data() {
    return {
      menulist: [],
      isCollapse: false,
      iconsobj: [
        "el-icon-user",
        "el-icon-info",
        "el-icon-goods",
        "el-icon-s-order",
        "el-icon-s-marketing",
      ],
      iconsLcon: {
        110: "el-icon-s-check",
        111: "el-icon-user",
        112: "el-icon-setting",
        104: "el-icon-s-grid",
        115: "el-icon-document-copy",
        121: "el-icon-s-data",
        107: "el-icon-edit-outline",
        146: "el-icon-office-building",
      },
    };
  },
  mounted() {
    this.getmenu();
  },
  methods: {
    //点击退出
    lclogout() {
      window.sessionStorage.removeItem("lc_05B");
      this.$router.push("/login");
    },
    //菜单栏信息
    async getmenu() {
      let { data: res } = await muney.getList();
      console.log(res);
      this.menulist = res;
    },
  },
  computed: {},
  watch: {},
};
</script>

<style lang="scss" scoped>
.el-container {
  width: 100%;
  min-height: 716px;
  .el-header {
    padding: 0px 20px;
    background-color: #373d41;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .logo {
      height: 95%;
      display: flex;
      align-items: center;
      span {
        font-size: 24px;
        color: white;
      }
      img {
        width: 61px;
        height: 100%;
        margin-right: 15px;
        border-radius: 50%;
        background-color: rgb(158, 180, 221);
      }
    }
    
    .el-button {
      height: 75%;
    }
  }
  .el-aside {
    background-color: #333744;
    .extend {
      background-color: #4a5064;
      text-align: center;
      color: white;
    }
  }
  .el-menu {
    border: none;
  }
}
</style>
